package com.xh.bussiness.tms.controller;

import com.xh.bussiness.tms.model.ExceptDate;
import com.xh.bussiness.tms.service.IExceptDateService;
import com.xh.core.bean.AjaxResult;
import com.xh.core.constant.AjaxResultConstant;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/exceptDate")
public class ExceptDateController {

    @Autowired
    private IExceptDateService exceptDateService;

    @ApiOperation(value = "新增排课信息或者更新排课信息",notes = "新增排课信息或者更新排课信息")
    @PostMapping("/saveOrUpdate")
    public AjaxResult saveOrUpdate(@Validated ExceptDate bean){
        if(bean.getId()==null){
            exceptDateService.insert(bean);
        }else{
            exceptDateService.update(bean);
        }
        return new AjaxResult(AjaxResultConstant.Result.SUCCESS);
    }
}
